﻿package mortal.game.view.mining.panel
{
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import fl.data.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.mining.*;
    import mortal.game.view.mining.render.*;
    import mortal.mvc.interfaces.*;

    public class MiningHelpPanel extends BaseWindow
    {
        private var _list:GTileList;
        private var _stars:MiningStar;
        private var _txtUsedNum:GTextFiled;

        public function MiningHelpPanel(param1:ILayer = null)
        {
            super(param1);
            super.setSize(316, 260);
            return;
        }// end function

        public function updateAllDatas() : Boolean
        {
            var _loc_1:* = Cache.instance.mining.getBeAskHelpDataProvider();
            if (_loc_1.length == 0)
            {
                MiningHintIcon.instance.hide();
                this.hide();
                return false;
            }
            this._list.dataProvider = _loc_1;
            this._list.drawNow();
            this._stars.updateStars(100, Cache.instance.mining.getTodayStar());
            this._txtUsedNum.text = Cache.instance.mining.getTodayHelpOthersNum().toString() + "/" + GameConst.TRoutineTaskRefreshCount;
            return true;
        }// end function

        override public function hide() : void
        {
            super.hide();
            Cache.instance.mining.clearBeAskHelp();
            MiningHintIcon.instance.hide();
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._list = UIFactory.tileList(10, 38, 294, 192, this);
            this._list.isClickedUpdate = false;
            this._list.setStyle("cellRenderer", MiningHelpOthersRender);
            this._list.rowHeight = 51;
            this._list.columnWidth = 284;
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.color = 16252126;
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(21032), 77, 234, 100, 20, this, _loc_1.clone()));
            this._stars = UICompomentPool.getUICompoment(MiningStar) as MiningStar;
            this._stars.updateStars(100, 4);
            this._stars.x = 181;
            this._stars.y = 236;
            this.addChild(this._stars);
            this._txtUsedNum = UIFactory.gTextField("(0/3)", 218, 234, 100, 20, this, _loc_1.clone());
            LoaderHelp.addResCallBack(ResFileConst.mining, this.resLoaded);
            return;
        }// end function

        private function resLoaded() : void
        {
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._list.dispose(param1);
            this._list = null;
            this._stars.dispose(param1);
            this._stars = null;
            this._txtUsedNum.dispose(param1);
            this._txtUsedNum = null;
            return;
        }// end function

    }
}
